//前端常量

//评测状态
export const JUDGE_STATUS = {
    '-10': {
        name: 'Not Submitted',
        short: 'NS',
        color: 'gray',
        type: 'info',
        rgb: '#909399'
    },
    '-5': {
        name: 'Submitted Unknown Result',
        short: 'SNR',
        color: 'gray',
        type: 'info',
        rgb: '#909399'
    },
    '-4': {
        name: 'Cancelled',
        short: 'CA',
        color: 'purple',
        type: 'info',
        rgb: '#676fc1'
    },
    '-3': {
        name: 'Presentation Error',
        short: 'PE',
        color: 'yellow',
        type: 'warning',
        rgb: '#f90'
    },
    '-2': {
        name: 'Compile Error',
        short: 'CE',
        color: 'yellow',
        type: 'warning',
        rgb: '#f90'
    },
    '-1': {
        name: 'Wrong Answer',
        short: 'WA',
        color: 'red',
        type: 'error',
        rgb: '#ed3f14'
    },
    '0': {
        name: 'Accepted',
        short: 'AC',
        color: 'green',
        type: 'success',
        rgb: '#19be6b'
    },
    '1': {
        name: 'Time Limit Exceeded',
        short: 'TLE',
        color: 'red',
        type: 'error',
        rgb: '#ed3f14'
    },
    '2': {
        name: 'Memory Limit Exceeded',
        short: 'MLE',
        color: 'red',
        type: 'error',
        rgb: '#ed3f14'
    },
    '3': {
        name: 'Runtime Error',
        short: 'RE',
        color: 'red',
        type: 'error',
        rgb: '#ed3f14'
    },
    '4': {
        name: 'System Error',
        short: 'SE',
        color: 'gray',
        type: 'info',
        rgb: '#909399'
    },
    '5': {
        name: 'Pending',
        color: 'yellow',
        type: 'warning',
        rgb: '#f90'
    },
    '6': {
        name: 'Compiling',
        short: 'CP',
        color: 'green',
        type: 'info',
        rgb: '#25bb9b'
    },
    '7': {
        name: 'Judging',
        color: 'blue',
        type: '',
        rgb: '#2d8cf0'
    },
    '8': {
        name: 'Partial Accepted',
        short: 'PAC',
        color: 'blue',
        type: '',
        rgb: '#2d8cf0'
    },
    '9': {
        name: 'Submitting',
        color: 'yellow',
        type: 'warning',
        rgb: '#f90'
    },
    '10': {
        name: "Submitted Failed",
        color: 'gray',
        short: 'SF',
        type: 'info',
        rgb: '#909399',
    }
}

//评测状态码
export const JUDGE_STATUS_RESERVE = {
    'ns': -10,
    'snr': -5,
    'ca': -4,
    'pe': -3,
    'ce': -2,
    'wa': -1,
    'ac': 0,
    'tle': 1,
    'mle': 2,
    're': 3,
    'se': 4,
    'Pending': 5,
    'Compiling': 6,
    'Judging': 7,
    'pa': 8,
    'Submitting': 9,
    'sf': 10,
}

//题目难度
export const PROBLEM_LEVEL = {
    '0': {
        name: {
            'zh-CN': '简单',
            'en-US': 'Easy',
        },
        color: '#19be6b'
    },
    '1': {
        name: {
            'zh-CN': '中等',
            'en-US': 'Mid',
        },
        color: '#2d8cf0'
    },
    '2': {
        name: {
            'zh-CN': '困难',
            'en-US': 'Hard',
        },
        color: '#ed3f14'
    }
}

//评测规则
export const RULE_TYPE = {
    ACM: 0,
    OI: 1
}

//用户状态
export const USER_TYPE = {
    REGULAR_USER: 'user',
    ADMIN: 'admin',
    PROBLEM_ADMIN: 'problem_admin',
    SUPER_ADMIN: 'root'
}

//评测样例模式
export const JUDGE_CASE_MODE = {
    DEFAULT: 'default',
    SUBTASK_LOWEST: 'subtask_lowest',
    SUBTASK_AVERAGE: 'subtask_average',
    ERGODIC_WITHOUT_ERROR: 'ergodic_without_error'
}

//储存Key
export const STORAGE_KEY = {
    AUTHED: 'authed',
    PROBLEM_CODE_AND_SETTING: 'ProblemCodeAndSetting',
    languages: 'languages',
    individualLanguageAndSetting: 'IndividualLanguageAndSetting'
}

export function buildIndividualLanguageAndSettingKey() {
    return `${STORAGE_KEY.individualLanguageAndSetting}`
}

export function buildProblemCodeAndSettingKey(problemID) {
    return `${STORAGE_KEY.PROBLEM_CODE_AND_SETTING}_${problemID}`
}
